import java.util.Arrays;

public class TestHomework {
    String str = new String("good");
    char[ ] ch = { 'a' , 'b' , 'c' };
    public static void main2(String args[]){
        TestHomework ex = new TestHomework();
        ex.change(ex.str,ex.ch);
        System.out.print(ex.str + " and ");//依然是good and
        System.out.print(ex.ch);
    }
    public void change(String str,char ch[ ]){
        str = "test ok";
        ch[0] = 'g';
    }
    //计算单词数
    public static int countSegments(String s) {
        if (s.length()==0||s==null){
            return 0;
        }
        //以空格分割
        String[] str=s.split(" ");
        int count=0;
        for (String x:str) {
            if (x.length()!=0){
                count++;//不是空格就+1
            }
        }
        return count;
    }
    public static String toLowerCase(String s) {
        if (s==null||s.length()==0){
            return null;
        }
        int i=0;
        StringBuffer s1=new StringBuffer();
        while(i<s.length()){
            char ch;
            ch=s.charAt(i);
            if (ch >= 'A'&&ch<='Z'){
                char ch2= (char) (ch+32);
                s1.append(ch2);
            }else {
                s1.append(ch);
            }
            i++;
        }
        return s1.toString();
    }

    public static void main(String[] args) {
        String s=new String("Heavy");

        System.out.println(toLowerCase(s));
    }
}
